package com.rd.student.jike.class2.xuezhixin.day0728;

import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.Collections;
import java.util.LinkedList;
import java.util.Scanner;

public class Work02 {

    public static void main(String[] args) throws Exception{

        File file = new File("all.txt");
        InputStream is = new FileInputStream(file);
        byte[] arr = new byte[1024];
        is.read(arr);
        String str = new String(arr);
        String str1 = "";
        LinkedList list = new LinkedList();
        for (int i = 0;i<str.length();i++){
            if(str.charAt(i) == '、') {
                list.add(str1);
                str1 = "";
                continue;
            }
            str1 = str1 + "" + str.charAt(i);
        }

        Collections.shuffle(list);
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入您想随机名字的个数：");
        int num = scanner.nextInt();
        for(int i = 0;i<num;i++){
            System.out.println(list.get(i));
        }
        is.close();
    }
}
